package com.yyq.studyList;

import com.yyq.javastudy.Persion;
import org.junit.Test;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;

/**
 * @author yyq
 * @create 2021-08-06 13:03
 */
public class fortest {
    @Test
    public void test(){
        //体现多态性 编译看左边 运行看右边
        Collection coll=new ArrayList();
        coll.add(new Persion(22,"YQQ"));
        coll.add("aa");
        coll.add("bb");
        coll.add(123);
        coll.add(new Date());
        coll.add(new String("Tom"));

        for(Object obj : coll){
            System.out.println(obj.toString());
        }
    }
}
